package com.ruoyi.project.cms.content.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cms.content.domain.Content;
import com.ruoyi.project.cms.content.domain.ContentVo;
import com.ruoyi.project.cms.content.service.ContentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/cms/content")
public class ContentController extends BaseController {

    private String prefix = "cms/content";

    @Autowired
    private ContentService contentService;


    @RequiresPermissions("cms:content:view")
    @GetMapping()
    public String operlog()
    {
        return prefix + "/content";
    }

    @RequiresPermissions("cms:type:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Content content)
    {
        startPage();
        List<ContentVo> list = contentService.selectContentList(content);
        return getDataTable(list);
    }

}
